<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="author" content="李愧愧">
    <title></title>
    <style>

    </style>
</head>

<body>

    <script>
        // 3，一个数组中存放着若干人名，找出所有姓王的名字。
        var arr = ['王俊凯', '王源', '王某某', '李愧愧', '施凯月', '高海棠'];

        function xingWang(arr) {
            for (var i = 0; i < arr.length; i++) {
                if (arr[i].startsWith('王') == true) {
                    document.write(arr[i]+' ');
                }
            }
        }
        xingWang(arr)
    </script>
</body>
<ml>